home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2005 November / WNnov2005.iso / Windows / Equipement / hMailServer / hMailServer-4.1-Build-136.exe / {app} / PHPWebAdmin / plugins / plugin_searchemail.php
PHP Script  |  2004-10-31  |  2KB  |  72 lines

  1. <?php
  2. /*
  3. ** $Id: plugin_searchemail.php,v 1.2 2004/10/31 07:50:10 rabol Exp $
  4. **
  5. **    hMailServer - Web interface
  6. **
  7. **    File formatted using TAB size 4
  8. **
  9. **    Get hMailserver at http://www.hmailserver.com
  10. **
  11. **    Author: Steen Rab°l <srabol@mail.tele.dk>
  12. **    Copyright (c) 2004, Steen Rab°l <srabol@mail.tele.dk>
  13. **
  14. **  This program is free software; you can redistribute it and/or modify
  15. **  it under the terms of the GNU General Public License as published by
  16. **  the Free Software Foundation; either version 2 of the License, or
  17. **  (at your option) any later version.
  18. **
  19. **  You may not change or alter any portion of this comment or credits
  20. **  of supporting developers from this source code or any supporting
  21. **  source code which is considered copyrighted (c) material of the
  22. **  original comment or credit authors.
  23. **
  24. **  This program is distributed in the hope that it will be useful,
  25. **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  27. **  GNU General Public License for more details.
  28. **
  29. **  You should have received a copy of the GNU General Public License
  30. **  along with this program; if not, write to the Free Software
  31. **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  32. **
  33. */
  34.  
  35. function plugin_searchemail_menu()
  36. {
  37.     return hmailGetLocaleText("search_email");
  38. }
  39.  
  40. function plugin_searchemail($p_parm)
  41. {
  42.     global $hmailSmarty,$obBaseApp;
  43.  
  44.     $function = hmailGetVar("pluginfunction");
  45.     if($function == "dosearch")
  46.     {
  47.         $searchvalue = hmailGetVar("searchvalue");
  48.         if($searchvalue != "")
  49.         {
  50.             $obDomains = $obBaseApp->Domains();
  51.             if($obDomains->Count())
  52.             {
  53.                 for($i = 0; $i < $obDomains->Count(); $i++)
  54.                 {
  55.                     $obDomain = $obDomains->Item($i);
  56.                     $obAccounts = $obDomain->Accounts();
  57.                     if($obAccounts->Count())
  58.                     {
  59.                         for($j = 0; $j < $obAccounts->Count(); $j++)
  60.                         {
  61.                             $obAccount = $obAccounts->Item($j);
  62.                             if(stristr($obAccount->Address,$searchvalue))
  63.                                 $hmailSmarty->append("accounts", $obAccount);
  64.                         }
  65.                     }
  66.                 }
  67.             }
  68.         }
  69.     }
  70.     $hmailSmarty->assign("pagecontent", $hmailSmarty->fetch('plugin_searchemail.tpl'));
  71. }
  72. ?>